from math import *
from util import format_number


class ColorRGBA(object):

    __slots__ = ('_c',)


    def __init__(self, *args):

        """Creates a color object."""

        if not args:
            self._c = [0.0, 0.0, 0.0, 1.0]
            return

        if len(args) == 1:
            args = args[0]

        if len(args) == 3:
            r, g, b = args
            self._c = [float(r), float(g), float(b), 1.0]
            return
        if len(args) == 4:
            r, g, b, a = args
            self._c = [float(r), float(g), float(b), float(a)]
            return

        raise ValueError("0, 1, 3 or 4 values required")

    def __str__(self):

        return "(" + ", ".join(format_number(c) for c in self._c) + ")"
        #return "(" + ", ".join(map(str, self._c)) + ")"

    def __repr__(self):

        return "ColorRGBA(" + ", ".join(map(str, self._c)) + ")"

    @classmethod
    def black(cls):

        """Create a color object representing black."""

        c = cls.__new__(cls, object)
        c._c = [0.0, 0.0, 0.0, 1.0]
        return c

    @classmethod
    def white(cls):

        """Create a color object representing white."""

        c = cls.__new__(cls, object)
        c._c = [1.0, 1.0, 1.0, 1.0]
        return c


    @classmethod
    def from_floats(cls, r, g, b, a=1.0):

        """Creates a color object from float components.

        r -- Red component
        g -- Green component
        b -- Blue component
        a -- Alpha component

        """

        c = cls.__new__(cls, object)
        c._c = [r, g, b, a]
        return c

    @classmethod
    def from_rgba8(cls, r, g, b, a=255.0):

        """Creates a color object from 4 integer components in 0->255 range.

        r -- Red component
        g -- Green component
        b -- Blue component
        a -- Alpha component

        """

        c = cls.__new__(cls, object)
        c._c = [r / 255.0, g / 255.0, b / 255.0, a / 255.0]
        return c


    @classmethod
    def from_html(cls, col_str, a=1.0):

        """Creates a color object from an html style color string.

        col_str -- The color string (eg. "#FF0000")

        """

        if len(col_str) != 7 or col_str[0] != '#':
            raise ValueError("Requires a color encoded in a html style string")

        c = cls.__new__(cls, object)

        components = col_str[1:3], col_str[3:5], col_str[5:6]

        try:
            c._c = [ int(s, 16) / 255.0 for s in components ] + [ a ]
        except ValueError:
            raise ValueError \
                ("Components should be encoded as two hex characters")


    @classmethod
    def grey(self, level):

        """Creates a 'grey' color.

        level -- Grey level (0 is black, 1. is 'full' white)

        """

        level = level * 1.0
        c = cls.__new__(cls, object)
        c._c = [level, level, level, 1.0]
        return c
    gray = grey

    @classmethod
    def from_palette(cls, color_name):

        try:
            c = cls.__new__(cls, object)
            r, g, b = _palette[color_name]
            c._c = [r, g, b, 1.0]
            return c
        except KeyError:
            raise ValueError( "Unknown color name (%s)" % color_name )


    def copy(self):

        """Returns a copy of the color object."""

        c = self.__new__(self.__class__, object)
        c._c = self._c[:]
        return c
    __copy__ = copy

    def _get_r(self):
        return self._c[0]
    def _set_r(self, r):
        try:
            self._c[0] = 1.0 * r
        except TypeError:
            raise TypeError( "Must be a number" )
    r = property(_get_r, _set_r, None, "Red component.")

    def _get_g(self):
        return self._c[1]
    def _set_g(self, g):
        try:
            self._c[1] = 1.0 * g
        except TypeError:
            raise TypeError( "Must be a number" )
    g = property(_get_g, _set_g, None, "Green component.")

    def _get_b(self):
        return self._c[2]
    def _set_b(self, b):
        try:
            self._c[2] = b
        except TypeError:
            raise TypeError( "Must be a number" )
    b = property(_get_b, _set_b, None, "Blue component.")

    def _get_a(self):
        return self._c[3]
    def _set_a(self, a):
        try:
            self._c[3] = a
        except TypeError:
            raise TypeError( "Must be a number" )
    a = property(_get_a, _set_a, None, "Alpha component.")

    def _get_rgba8(self):
        r, g, b, a = self._c
        r = min(max(r, 0.0), 1.0) * 255.0
        g = min(max(g, 0.0), 1.0) * 255.0
        b = min(max(b, 0.0), 1.0) * 255.0
        a = min(max(a, 0.0), 1.0) * 255.0
        return (int(r), int(g), int(b), int(a))
    def _set_rgba8(self, rgba):
        r, g, b, a = rgba
        c = self._c
        c[0] = r / 255.0
        c[1] = g / 255.0
        c[2] = b / 255.0
        c[3] = a / 255.0
        return self
    rgba8 = property(_get_rgba8, _set_rgba8, None, "RGBA integer 8 bit format")

    def _get_rgb8(self):
        r, g, b, a = self._c
        r = min(max(r, 0.0), 1.0) * 255.0
        g = min(max(g, 0.0), 1.0) * 255.0
        b = min(max(b, 0.0), 1.0) * 255.0
        return (int(r), int(g), int(b))
    def _set_rgb8(self, rgb):
        r, g, b = rgb
        c = self._c
        c[0] = r / 255.0
        c[1] = g / 255.0
        c[2] = b / 255.0
        c[3] = 1.0
        return self
    rgb8 = property(_get_rgb8, _set_rgb8, None, "RGB integer 8 bit format")


    def __len__(self):
        return 4

    def __iter__(self):
        return iter(self._c[:])

    def __getitem__(self, index):
        try:
            return self._c[index]
        except IndexError:
            raise IndexError( "Index must be 0, 1, 2, or 3" )

    def __setitem__(self, index, value):
        assert isinstance(value, float), "Must be a float"
        try:
            self._c[index] = 1.0 * value
        except IndexError:
            raise IndexError( "Index must be 0, 1, 2, or 3" )
        except ValueError:
            raise ValueError( "Must be a number" )

    def __eq__(self, rhs):

        r, g, b, a = self._c
        rr, gg, bb, aa = rhs
        return r == rr and g == gg and b == bb and a == aa

    def __ne__(self, rhs):

        r, g, b, a = self._c
        rr, gg, bb, aa = rhs
        return r != rr or g != gg or b != bb or a != aa

    def __hash__(self):

        return hash(tuple(self._c))

    def __add__(self, rhs):

        r, g, b, a = self._c
        rr, gg, bb = rhs[:3]

        return self.from_floats(r+rr, g+gg, b+bb, a)

    def __iadd__(self, rhs):

        r, g, b = rhs[:3]
        c = self._c
        c[0] += r
        c[1] += g
        c[2] += b
        return self

    def __radd__(self, lhs):

        r, g, b, a = self._c
        rr, gg, bb = lhs[:3]
        return self.from_floats(rr + r, gg + g, bb + b, a)

    def __sub__(self, rhs):

        r, g, b, a = self._c
        rr, gg, bb = rhs[:3]

        return self.from_floats(r - rr, g - gg, b - bb, a)

    def __isub__(self, rhs):

        r, g, b = rhs[:3]
        c = self._c
        c[0] -= r
        c[1] -= g
        c[2] -= b
        return self

    def __rsub__(self, lhs):

        r, g, b = self._c
        rr, gg, bb = lhs[:3]
        return self.from_floats(rr - r, gg - g, bb - b, a)

    def __mul__(self, rhs):

        r, g, b, a = self._c
        return self.from_floats(r * rhs, g * rhs, b * rhs, a)

    def __imul__(self, rhs):

        c = self._c
        c[0] *= rhs
        c[1] *= rhs
        c[2] *= rhs
        return self

    def __rmul__(self, lhs):

        r, g, b, a = self._c
        return self.from_floats(lhs * r, lhs * g, lhs * b, a)

    def __div__(self, rhs):

        r, g, b, a = self._c
        return self.from_floats(r / rhs, g / rhs, b / rhs, a)

    def __idiv__(self, rhs):

        c = self._c
        c[0] *= rhs
        c[1] *= rhs
        c[2] *= rhs
        return self

    def __rdiv__(self, lhs):

        r, g, b, a = self._c
        return self.from_floats(lhs / r, lhs / g, lhs / b, a)

    def __neg__(self):

        r, g, b, a = self._c
        return self.from_floats(-r, -g, -b, a)

    def __pos__(self):

        return self.copy()

    def __nonzero__(self):

        r, g, b, a = self._c
        return bool(r or g or b or a)

    def __call__(self, keys):

        c = self._c
        try:
            return tuple(c["rgba".index(k)] for k in keys)
        except ValueError:
            raise IndexError("Keys must be one of r, g, b, a")


    def as_tuple(self):

        return tuple(self._c)

    def as_tuple_rgb(self):

        return tuple(self._c[:3])

    def as_tuple_rgba(self):

        return tuple(self._c)


    def __int__(self):

        """Convert the color to a packed RGBA integer."""

        r, g, b, a = self.rgba8
        return (int(a) << 24) | (int(r) << 16) | (int(g) << 8) | int(b)


    def as_html(self):

        """Returns the color encoded as an html style string."""

        r, g, b, a = self.get_saturate() * 255.
        return "#%02X%02X%02X"%(r, g, b)


    def saturate(self):

        """Saturates the color, so that all components are in the range 0->1"""

        c = self._c
        r, g, b, a = c
        c[0] = min(max(r, 0.0), 1.0)
        c[1] = min(max(g, 0.0), 1.0)
        c[2] = min(max(b, 0.0), 1.0)
        c[3] = min(max(a, 0.0), 1.0)

    def get_saturate(self):

        """Returns the saturated color as a copy."""

        col_copy = self.copy()
        c = col_copy._c

        r, g, b, a = c
        c[0] = min(max(r, 0.0), 1.0)
        c[1] = min(max(g, 0.0), 1.0)
        c[2] = min(max(b, 0.0), 1.0)
        c[3] = min(max(a, 0.0), 1.0)

        return col_copy

    def invert(self):

        """Inverts the color."""

        c = self._c
        r, g, b, a = c
        c[0] = 1.0 - r
        c[1] = 1.0 - g
        c[2] = 1.0 - b

    def get_inverse(self):

        """Gets the inverse of the color."""

        col_copy = self.copy()

        c = col_copy._c
        r, g, b, a = c
        c[0] = 1.0 - r
        c[1] = 1.0 - g
        c[2] = 1.0 - b

        return col_copy

    def mul_alpha(self):

        """Multiplies the color by its alpha component."""

        c = self._c
        a = c[3]
        c[0] *= a
        c[1] *= a
        c[2] *= a

Color = ColorRGBA



_palette = {
    'snow' : (1.0, 0.980392156863, 0.980392156863),
    'ghostwhite' : (0.972549019608, 0.972549019608, 1.0),
    'whitesmoke' : (0.960784313725, 0.960784313725, 0.960784313725),
    'gainsboro' : (0.862745098039, 0.862745098039, 0.862745098039),
    'floralwhite' : (1.0, 0.980392156863, 0.941176470588),
    'oldlace' : (0.992156862745, 0.960784313725, 0.901960784314),
    'linen' : (0.980392156863, 0.941176470588, 0.901960784314),
    'antiquewhite' : (0.980392156863, 0.921568627451, 0.843137254902),
    'papayawhip' : (1.0, 0.937254901961, 0.835294117647),
    'blanchedalmond' : (1.0, 0.921568627451, 0.803921568627),
    'bisque' : (1.0, 0.894117647059, 0.76862745098),
    'peachpuff' : (1.0, 0.854901960784, 0.725490196078),
    'navajowhite' : (1.0, 0.870588235294, 0.678431372549),
    'moccasin' : (1.0, 0.894117647059, 0.709803921569),
    'cornsilk' : (1.0, 0.972549019608, 0.862745098039),
    'ivory' : (1.0, 1.0, 0.941176470588),
    'lemonchiffon' : (1.0, 0.980392156863, 0.803921568627),
    'seashell' : (1.0, 0.960784313725, 0.933333333333),
    'honeydew' : (0.941176470588, 1.0, 0.941176470588),
    'mintcream' : (0.960784313725, 1.0, 0.980392156863),
    'azure' : (0.941176470588, 1.0, 1.0),
    'aliceblue' : (0.941176470588, 0.972549019608, 1.0),
    'lavender' : (0.901960784314, 0.901960784314, 0.980392156863),
    'lavenderblush' : (1.0, 0.941176470588, 0.960784313725),
    'mistyrose' : (1.0, 0.894117647059, 0.882352941176),
    'white' : (1.0, 1.0, 1.0),
    'black' : (0.0, 0.0, 0.0),
    'darkslategrey' : (0.18431372549, 0.309803921569, 0.309803921569),
    'dimgrey' : (0.411764705882, 0.411764705882, 0.411764705882),
    'slategrey' : (0.439215686275, 0.501960784314, 0.564705882353),
    'lightslategrey' : (0.466666666667, 0.533333333333, 0.6),
    'grey' : (0.745098039216, 0.745098039216, 0.745098039216),
    'lightgrey' : (0.827450980392, 0.827450980392, 0.827450980392),
    'midnightblue' : (0.0980392156863, 0.0980392156863, 0.439215686275),
    'navy' : (0.0, 0.0, 0.501960784314),
    'navyblue' : (0.0, 0.0, 0.501960784314),
    'cornflowerblue' : (0.392156862745, 0.58431372549, 0.929411764706),
    'darkslateblue' : (0.282352941176, 0.239215686275, 0.545098039216),
    'slateblue' : (0.41568627451, 0.352941176471, 0.803921568627),
    'mediumslateblue' : (0.482352941176, 0.407843137255, 0.933333333333),
    'lightslateblue' : (0.517647058824, 0.439215686275, 1.0),
    'mediumblue' : (0.0, 0.0, 0.803921568627),
    'royalblue' : (0.254901960784, 0.411764705882, 0.882352941176),
    'blue' : (0.0, 0.0, 1.0),
    'dodgerblue' : (0.117647058824, 0.564705882353, 1.0),
    'deepskyblue' : (0.0, 0.749019607843, 1.0),
    'skyblue' : (0.529411764706, 0.807843137255, 0.921568627451),
    'lightskyblue' : (0.529411764706, 0.807843137255, 0.980392156863),
    'steelblue' : (0.274509803922, 0.509803921569, 0.705882352941),
    'lightsteelblue' : (0.690196078431, 0.76862745098, 0.870588235294),
    'lightblue' : (0.678431372549, 0.847058823529, 0.901960784314),
    'powderblue' : (0.690196078431, 0.878431372549, 0.901960784314),
    'paleturquoise' : (0.686274509804, 0.933333333333, 0.933333333333),
    'darkturquoise' : (0.0, 0.807843137255, 0.819607843137),
    'mediumturquoise' : (0.282352941176, 0.819607843137, 0.8),
    'turquoise' : (0.250980392157, 0.878431372549, 0.81568627451),
    'cyan' : (0.0, 1.0, 1.0),
    'lightcyan' : (0.878431372549, 1.0, 1.0),
    'cadetblue' : (0.372549019608, 0.619607843137, 0.627450980392),
    'mediumaquamarine' : (0.4, 0.803921568627, 0.666666666667),
    'aquamarine' : (0.498039215686, 1.0, 0.83137254902),
    'darkgreen' : (0.0, 0.392156862745, 0.0),
    'darkolivegreen' : (0.333333333333, 0.419607843137, 0.18431372549),
    'darkseagreen' : (0.560784313725, 0.737254901961, 0.560784313725),
    'seagreen' : (0.180392156863, 0.545098039216, 0.341176470588),
    'mediumseagreen' : (0.235294117647, 0.701960784314, 0.443137254902),
    'lightseagreen' : (0.125490196078, 0.698039215686, 0.666666666667),
    'palegreen' : (0.596078431373, 0.98431372549, 0.596078431373),
    'springgreen' : (0.0, 1.0, 0.498039215686),
    'lawngreen' : (0.486274509804, 0.988235294118, 0.0),
    'green' : (0.0, 1.0, 0.0),
    'chartreuse' : (0.498039215686, 1.0, 0.0),
    'mediumspringgreen' : (0.0, 0.980392156863, 0.603921568627),
    'greenyellow' : (0.678431372549, 1.0, 0.18431372549),
    'limegreen' : (0.196078431373, 0.803921568627, 0.196078431373),
    'yellowgreen' : (0.603921568627, 0.803921568627, 0.196078431373),
    'forestgreen' : (0.133333333333, 0.545098039216, 0.133333333333),
    'olivedrab' : (0.419607843137, 0.556862745098, 0.137254901961),
    'darkkhaki' : (0.741176470588, 0.717647058824, 0.419607843137),
    'khaki' : (0.941176470588, 0.901960784314, 0.549019607843),
    'palegoldenrod' : (0.933333333333, 0.909803921569, 0.666666666667),
    'lightgoldenrodyellow' : (0.980392156863, 0.980392156863, 0.823529411765),
    'lightyellow' : (1.0, 1.0, 0.878431372549),
    'yellow' : (1.0, 1.0, 0.0),
    'gold' : (1.0, 0.843137254902, 0.0),
    'lightgoldenrod' : (0.933333333333, 0.866666666667, 0.509803921569),
    'goldenrod' : (0.854901960784, 0.647058823529, 0.125490196078),
    'darkgoldenrod' : (0.721568627451, 0.525490196078, 0.043137254902),
    'rosybrown' : (0.737254901961, 0.560784313725, 0.560784313725),
    'indianred' : (0.803921568627, 0.360784313725, 0.360784313725),
    'saddlebrown' : (0.545098039216, 0.270588235294, 0.0745098039216),
    'sienna' : (0.627450980392, 0.321568627451, 0.176470588235),
    'peru' : (0.803921568627, 0.521568627451, 0.247058823529),
    'burlywood' : (0.870588235294, 0.721568627451, 0.529411764706),
    'beige' : (0.960784313725, 0.960784313725, 0.862745098039),
    'wheat' : (0.960784313725, 0.870588235294, 0.701960784314),
    'sandybrown' : (0.956862745098, 0.643137254902, 0.376470588235),
    'tan' : (0.823529411765, 0.705882352941, 0.549019607843),
    'chocolate' : (0.823529411765, 0.411764705882, 0.117647058824),
    'firebrick' : (0.698039215686, 0.133333333333, 0.133333333333),
    'brown' : (0.647058823529, 0.164705882353, 0.164705882353),
    'darksalmon' : (0.913725490196, 0.588235294118, 0.478431372549),
    'salmon' : (0.980392156863, 0.501960784314, 0.447058823529),
    'lightsalmon' : (1.0, 0.627450980392, 0.478431372549),
    'orange' : (1.0, 0.647058823529, 0.0),
    'darkorange' : (1.0, 0.549019607843, 0.0),
    'coral' : (1.0, 0.498039215686, 0.313725490196),
    'lightcoral' : (0.941176470588, 0.501960784314, 0.501960784314),
    'tomato' : (1.0, 0.388235294118, 0.278431372549),
    'orangered' : (1.0, 0.270588235294, 0.0),
    'red' : (1.0, 0.0, 0.0),
    'hotpink' : (1.0, 0.411764705882, 0.705882352941),
    'deeppink' : (1.0, 0.078431372549, 0.576470588235),
    'pink' : (1.0, 0.752941176471, 0.796078431373),
    'lightpink' : (1.0, 0.713725490196, 0.756862745098),
    'palevioletred' : (0.858823529412, 0.439215686275, 0.576470588235),
    'maroon' : (0.690196078431, 0.188235294118, 0.376470588235),
    'mediumvioletred' : (0.780392156863, 0.0823529411765, 0.521568627451),
    'violetred' : (0.81568627451, 0.125490196078, 0.564705882353),
    'magenta' : (1.0, 0.0, 1.0),
    'violet' : (0.933333333333, 0.509803921569, 0.933333333333),
    'plum' : (0.866666666667, 0.627450980392, 0.866666666667),
    'orchid' : (0.854901960784, 0.439215686275, 0.839215686275),
    'mediumorchid' : (0.729411764706, 0.333333333333, 0.827450980392),
    'darkorchid' : (0.6, 0.196078431373, 0.8),
    'darkviolet' : (0.580392156863, 0.0, 0.827450980392),
    'blueviolet' : (0.541176470588, 0.16862745098, 0.886274509804),
    'purple' : (0.627450980392, 0.125490196078, 0.941176470588),
    'mediumpurple' : (0.576470588235, 0.439215686275, 0.858823529412),
    'thistle' : (0.847058823529, 0.749019607843, 0.847058823529),
    'snow1' : (1.0, 0.980392156863, 0.980392156863),
    'snow2' : (0.933333333333, 0.913725490196, 0.913725490196),
    'snow3' : (0.803921568627, 0.788235294118, 0.788235294118),
    'snow4' : (0.545098039216, 0.537254901961, 0.537254901961),
    'seashell1' : (1.0, 0.960784313725, 0.933333333333),
    'seashell2' : (0.933333333333, 0.898039215686, 0.870588235294),
    'seashell3' : (0.803921568627, 0.772549019608, 0.749019607843),
    'seashell4' : (0.545098039216, 0.525490196078, 0.509803921569),
    'antiquewhite1' : (1.0, 0.937254901961, 0.858823529412),
    'antiquewhite2' : (0.933333333333, 0.874509803922, 0.8),
    'antiquewhite3' : (0.803921568627, 0.752941176471, 0.690196078431),
    'antiquewhite4' : (0.545098039216, 0.513725490196, 0.470588235294),
    'bisque1' : (1.0, 0.894117647059, 0.76862745098),
    'bisque2' : (0.933333333333, 0.835294117647, 0.717647058824),
    'bisque3' : (0.803921568627, 0.717647058824, 0.619607843137),
    'bisque4' : (0.545098039216, 0.490196078431, 0.419607843137),
    'peachpuff1' : (1.0, 0.854901960784, 0.725490196078),
    'peachpuff2' : (0.933333333333, 0.796078431373, 0.678431372549),
    'peachpuff3' : (0.803921568627, 0.686274509804, 0.58431372549),
    'peachpuff4' : (0.545098039216, 0.466666666667, 0.396078431373),
    'navajowhite1' : (1.0, 0.870588235294, 0.678431372549),
    'navajowhite2' : (0.933333333333, 0.811764705882, 0.63137254902),
    'navajowhite3' : (0.803921568627, 0.701960784314, 0.545098039216),
    'navajowhite4' : (0.545098039216, 0.474509803922, 0.36862745098),
    'lemonchiffon1' : (1.0, 0.980392156863, 0.803921568627),
    'lemonchiffon2' : (0.933333333333, 0.913725490196, 0.749019607843),
    'lemonchiffon3' : (0.803921568627, 0.788235294118, 0.647058823529),
    'lemonchiffon4' : (0.545098039216, 0.537254901961, 0.439215686275),
    'cornsilk1' : (1.0, 0.972549019608, 0.862745098039),
    'cornsilk2' : (0.933333333333, 0.909803921569, 0.803921568627),
    'cornsilk3' : (0.803921568627, 0.78431372549, 0.694117647059),
    'cornsilk4' : (0.545098039216, 0.533333333333, 0.470588235294),
    'ivory1' : (1.0, 1.0, 0.941176470588),
    'ivory2' : (0.933333333333, 0.933333333333, 0.878431372549),
    'ivory3' : (0.803921568627, 0.803921568627, 0.756862745098),
    'ivory4' : (0.545098039216, 0.545098039216, 0.513725490196),
    'honeydew1' : (0.941176470588, 1.0, 0.941176470588),
    'honeydew2' : (0.878431372549, 0.933333333333, 0.878431372549),
    'honeydew3' : (0.756862745098, 0.803921568627, 0.756862745098),
    'honeydew4' : (0.513725490196, 0.545098039216, 0.513725490196),
    'lavenderblush1' : (1.0, 0.941176470588, 0.960784313725),
    'lavenderblush2' : (0.933333333333, 0.878431372549, 0.898039215686),
    'lavenderblush3' : (0.803921568627, 0.756862745098, 0.772549019608),
    'lavenderblush4' : (0.545098039216, 0.513725490196, 0.525490196078),
    'mistyrose1' : (1.0, 0.894117647059, 0.882352941176),
    'mistyrose2' : (0.933333333333, 0.835294117647, 0.823529411765),
    'mistyrose3' : (0.803921568627, 0.717647058824, 0.709803921569),
    'mistyrose4' : (0.545098039216, 0.490196078431, 0.482352941176),
    'azure1' : (0.941176470588, 1.0, 1.0),
    'azure2' : (0.878431372549, 0.933333333333, 0.933333333333),
    'azure3' : (0.756862745098, 0.803921568627, 0.803921568627),
    'azure4' : (0.513725490196, 0.545098039216, 0.545098039216),
    'slateblue1' : (0.513725490196, 0.435294117647, 1.0),
    'slateblue2' : (0.478431372549, 0.403921568627, 0.933333333333),
    'slateblue3' : (0.411764705882, 0.349019607843, 0.803921568627),
    'slateblue4' : (0.278431372549, 0.235294117647, 0.545098039216),
    'royalblue1' : (0.282352941176, 0.462745098039, 1.0),
    'royalblue2' : (0.262745098039, 0.43137254902, 0.933333333333),
    'royalblue3' : (0.227450980392, 0.372549019608, 0.803921568627),
    'royalblue4' : (0.152941176471, 0.250980392157, 0.545098039216),
    'blue1' : (0.0, 0.0, 1.0),
    'blue2' : (0.0, 0.0, 0.933333333333),
    'blue3' : (0.0, 0.0, 0.803921568627),
    'blue4' : (0.0, 0.0, 0.545098039216),
    'dodgerblue1' : (0.117647058824, 0.564705882353, 1.0),
    'dodgerblue2' : (0.109803921569, 0.525490196078, 0.933333333333),
    'dodgerblue3' : (0.0941176470588, 0.454901960784, 0.803921568627),
    'dodgerblue4' : (0.0627450980392, 0.305882352941, 0.545098039216),
    'steelblue1' : (0.388235294118, 0.721568627451, 1.0),
    'steelblue2' : (0.360784313725, 0.674509803922, 0.933333333333),
    'steelblue3' : (0.309803921569, 0.580392156863, 0.803921568627),
    'steelblue4' : (0.211764705882, 0.392156862745, 0.545098039216),
    'deepskyblue1' : (0.0, 0.749019607843, 1.0),
    'deepskyblue2' : (0.0, 0.698039215686, 0.933333333333),
    'deepskyblue3' : (0.0, 0.603921568627, 0.803921568627),
    'deepskyblue4' : (0.0, 0.407843137255, 0.545098039216),
    'skyblue1' : (0.529411764706, 0.807843137255, 1.0),
    'skyblue2' : (0.494117647059, 0.752941176471, 0.933333333333),
    'skyblue3' : (0.423529411765, 0.650980392157, 0.803921568627),
    'skyblue4' : (0.290196078431, 0.439215686275, 0.545098039216),
    'lightskyblue1' : (0.690196078431, 0.886274509804, 1.0),
    'lightskyblue2' : (0.643137254902, 0.827450980392, 0.933333333333),
    'lightskyblue3' : (0.552941176471, 0.713725490196, 0.803921568627),
    'lightskyblue4' : (0.376470588235, 0.482352941176, 0.545098039216),
    'lightsteelblue1' : (0.792156862745, 0.882352941176, 1.0),
    'lightsteelblue2' : (0.737254901961, 0.823529411765, 0.933333333333),
    'lightsteelblue3' : (0.635294117647, 0.709803921569, 0.803921568627),
    'lightsteelblue4' : (0.43137254902, 0.482352941176, 0.545098039216),
    'lightblue1' : (0.749019607843, 0.937254901961, 1.0),
    'lightblue2' : (0.698039215686, 0.874509803922, 0.933333333333),
    'lightblue3' : (0.603921568627, 0.752941176471, 0.803921568627),
    'lightblue4' : (0.407843137255, 0.513725490196, 0.545098039216),
    'lightcyan1' : (0.878431372549, 1.0, 1.0),
    'lightcyan2' : (0.819607843137, 0.933333333333, 0.933333333333),
    'lightcyan3' : (0.705882352941, 0.803921568627, 0.803921568627),
    'lightcyan4' : (0.478431372549, 0.545098039216, 0.545098039216),
    'paleturquoise1' : (0.733333333333, 1.0, 1.0),
    'paleturquoise2' : (0.682352941176, 0.933333333333, 0.933333333333),
    'paleturquoise3' : (0.588235294118, 0.803921568627, 0.803921568627),
    'paleturquoise4' : (0.4, 0.545098039216, 0.545098039216),
    'cadetblue1' : (0.596078431373, 0.960784313725, 1.0),
    'cadetblue2' : (0.556862745098, 0.898039215686, 0.933333333333),
    'cadetblue3' : (0.478431372549, 0.772549019608, 0.803921568627),
    'cadetblue4' : (0.325490196078, 0.525490196078, 0.545098039216),
    'turquoise1' : (0.0, 0.960784313725, 1.0),
    'turquoise2' : (0.0, 0.898039215686, 0.933333333333),
    'turquoise3' : (0.0, 0.772549019608, 0.803921568627),
    'turquoise4' : (0.0, 0.525490196078, 0.545098039216),
    'cyan1' : (0.0, 1.0, 1.0),
    'cyan2' : (0.0, 0.933333333333, 0.933333333333),
    'cyan3' : (0.0, 0.803921568627, 0.803921568627),
    'cyan4' : (0.0, 0.545098039216, 0.545098039216),
    'aquamarine1' : (0.498039215686, 1.0, 0.83137254902),
    'aquamarine2' : (0.462745098039, 0.933333333333, 0.776470588235),
    'aquamarine3' : (0.4, 0.803921568627, 0.666666666667),
    'aquamarine4' : (0.270588235294, 0.545098039216, 0.454901960784),
    'darkseagreen1' : (0.756862745098, 1.0, 0.756862745098),
    'darkseagreen2' : (0.705882352941, 0.933333333333, 0.705882352941),
    'darkseagreen3' : (0.607843137255, 0.803921568627, 0.607843137255),
    'darkseagreen4' : (0.411764705882, 0.545098039216, 0.411764705882),
    'seagreen1' : (0.329411764706, 1.0, 0.623529411765),
    'seagreen2' : (0.305882352941, 0.933333333333, 0.580392156863),
    'seagreen3' : (0.262745098039, 0.803921568627, 0.501960784314),
    'seagreen4' : (0.180392156863, 0.545098039216, 0.341176470588),
    'palegreen1' : (0.603921568627, 1.0, 0.603921568627),
    'palegreen2' : (0.564705882353, 0.933333333333, 0.564705882353),
    'palegreen3' : (0.486274509804, 0.803921568627, 0.486274509804),
    'palegreen4' : (0.329411764706, 0.545098039216, 0.329411764706),
    'springgreen1' : (0.0, 1.0, 0.498039215686),
    'springgreen2' : (0.0, 0.933333333333, 0.462745098039),
    'springgreen3' : (0.0, 0.803921568627, 0.4),
    'springgreen4' : (0.0, 0.545098039216, 0.270588235294),
    'green1' : (0.0, 1.0, 0.0),
    'green2' : (0.0, 0.933333333333, 0.0),
    'green3' : (0.0, 0.803921568627, 0.0),
    'green4' : (0.0, 0.545098039216, 0.0),
    'chartreuse1' : (0.498039215686, 1.0, 0.0),
    'chartreuse2' : (0.462745098039, 0.933333333333, 0.0),
    'chartreuse3' : (0.4, 0.803921568627, 0.0),
    'chartreuse4' : (0.270588235294, 0.545098039216, 0.0),
    'olivedrab1' : (0.752941176471, 1.0, 0.243137254902),
    'olivedrab2' : (0.701960784314, 0.933333333333, 0.227450980392),
    'olivedrab3' : (0.603921568627, 0.803921568627, 0.196078431373),
    'olivedrab4' : (0.411764705882, 0.545098039216, 0.133333333333),
    'darkolivegreen1' : (0.792156862745, 1.0, 0.439215686275),
    'darkolivegreen2' : (0.737254901961, 0.933333333333, 0.407843137255),
    'darkolivegreen3' : (0.635294117647, 0.803921568627, 0.352941176471),
    'darkolivegreen4' : (0.43137254902, 0.545098039216, 0.239215686275),
    'khaki1' : (1.0, 0.964705882353, 0.560784313725),
    'khaki2' : (0.933333333333, 0.901960784314, 0.521568627451),
    'khaki3' : (0.803921568627, 0.776470588235, 0.450980392157),
    'khaki4' : (0.545098039216, 0.525490196078, 0.305882352941),
    'lightgoldenrod1' : (1.0, 0.925490196078, 0.545098039216),
    'lightgoldenrod2' : (0.933333333333, 0.862745098039, 0.509803921569),
    'lightgoldenrod3' : (0.803921568627, 0.745098039216, 0.439215686275),
    'lightgoldenrod4' : (0.545098039216, 0.505882352941, 0.298039215686),
    'lightyellow1' : (1.0, 1.0, 0.878431372549),
    'lightyellow2' : (0.933333333333, 0.933333333333, 0.819607843137),
    'lightyellow3' : (0.803921568627, 0.803921568627, 0.705882352941),
    'lightyellow4' : (0.545098039216, 0.545098039216, 0.478431372549),
    'yellow1' : (1.0, 1.0, 0.0),
    'yellow2' : (0.933333333333, 0.933333333333, 0.0),
    'yellow3' : (0.803921568627, 0.803921568627, 0.0),
    'yellow4' : (0.545098039216, 0.545098039216, 0.0),
    'gold1' : (1.0, 0.843137254902, 0.0),
    'gold2' : (0.933333333333, 0.788235294118, 0.0),
    'gold3' : (0.803921568627, 0.678431372549, 0.0),
    'gold4' : (0.545098039216, 0.458823529412, 0.0),
    'goldenrod1' : (1.0, 0.756862745098, 0.145098039216),
    'goldenrod2' : (0.933333333333, 0.705882352941, 0.133333333333),
    'goldenrod3' : (0.803921568627, 0.607843137255, 0.113725490196),
    'goldenrod4' : (0.545098039216, 0.411764705882, 0.078431372549),
    'darkgoldenrod1' : (1.0, 0.725490196078, 0.0588235294118),
    'darkgoldenrod2' : (0.933333333333, 0.678431372549, 0.0549019607843),
    'darkgoldenrod3' : (0.803921568627, 0.58431372549, 0.0470588235294),
    'darkgoldenrod4' : (0.545098039216, 0.396078431373, 0.0313725490196),
    'rosybrown1' : (1.0, 0.756862745098, 0.756862745098),
    'rosybrown2' : (0.933333333333, 0.705882352941, 0.705882352941),
    'rosybrown3' : (0.803921568627, 0.607843137255, 0.607843137255),
    'rosybrown4' : (0.545098039216, 0.411764705882, 0.411764705882),
    'indianred1' : (1.0, 0.41568627451, 0.41568627451),
    'indianred2' : (0.933333333333, 0.388235294118, 0.388235294118),
    'indianred3' : (0.803921568627, 0.333333333333, 0.333333333333),
    'indianred4' : (0.545098039216, 0.227450980392, 0.227450980392),
    'sienna1' : (1.0, 0.509803921569, 0.278431372549),
    'sienna2' : (0.933333333333, 0.474509803922, 0.258823529412),
    'sienna3' : (0.803921568627, 0.407843137255, 0.223529411765),
    'sienna4' : (0.545098039216, 0.278431372549, 0.149019607843),
    'burlywood1' : (1.0, 0.827450980392, 0.607843137255),
    'burlywood2' : (0.933333333333, 0.772549019608, 0.56862745098),
    'burlywood3' : (0.803921568627, 0.666666666667, 0.490196078431),
    'burlywood4' : (0.545098039216, 0.450980392157, 0.333333333333),
    'wheat1' : (1.0, 0.905882352941, 0.729411764706),
    'wheat2' : (0.933333333333, 0.847058823529, 0.682352941176),
    'wheat3' : (0.803921568627, 0.729411764706, 0.588235294118),
    'wheat4' : (0.545098039216, 0.494117647059, 0.4),
    'tan1' : (1.0, 0.647058823529, 0.309803921569),
    'tan2' : (0.933333333333, 0.603921568627, 0.286274509804),
    'tan3' : (0.803921568627, 0.521568627451, 0.247058823529),
    'tan4' : (0.545098039216, 0.352941176471, 0.16862745098),
    'chocolate1' : (1.0, 0.498039215686, 0.141176470588),
    'chocolate2' : (0.933333333333, 0.462745098039, 0.129411764706),
    'chocolate3' : (0.803921568627, 0.4, 0.113725490196),
    'chocolate4' : (0.545098039216, 0.270588235294, 0.0745098039216),
    'firebrick1' : (1.0, 0.188235294118, 0.188235294118),
    'firebrick2' : (0.933333333333, 0.172549019608, 0.172549019608),
    'firebrick3' : (0.803921568627, 0.149019607843, 0.149019607843),
    'firebrick4' : (0.545098039216, 0.101960784314, 0.101960784314),
    'brown1' : (1.0, 0.250980392157, 0.250980392157),
    'brown2' : (0.933333333333, 0.23137254902, 0.23137254902),
    'brown3' : (0.803921568627, 0.2, 0.2),
    'brown4' : (0.545098039216, 0.137254901961, 0.137254901961),
    'salmon1' : (1.0, 0.549019607843, 0.411764705882),
    'salmon2' : (0.933333333333, 0.509803921569, 0.38431372549),
    'salmon3' : (0.803921568627, 0.439215686275, 0.329411764706),
    'salmon4' : (0.545098039216, 0.298039215686, 0.223529411765),
    'lightsalmon1' : (1.0, 0.627450980392, 0.478431372549),
    'lightsalmon2' : (0.933333333333, 0.58431372549, 0.447058823529),
    'lightsalmon3' : (0.803921568627, 0.505882352941, 0.38431372549),
    'lightsalmon4' : (0.545098039216, 0.341176470588, 0.258823529412),
    'orange1' : (1.0, 0.647058823529, 0.0),
    'orange2' : (0.933333333333, 0.603921568627, 0.0),
    'orange3' : (0.803921568627, 0.521568627451, 0.0),
    'orange4' : (0.545098039216, 0.352941176471, 0.0),
    'darkorange1' : (1.0, 0.498039215686, 0.0),
    'darkorange2' : (0.933333333333, 0.462745098039, 0.0),
    'darkorange3' : (0.803921568627, 0.4, 0.0),
    'darkorange4' : (0.545098039216, 0.270588235294, 0.0),
    'coral1' : (1.0, 0.447058823529, 0.337254901961),
    'coral2' : (0.933333333333, 0.41568627451, 0.313725490196),
    'coral3' : (0.803921568627, 0.356862745098, 0.270588235294),
    'coral4' : (0.545098039216, 0.243137254902, 0.18431372549),
    'tomato1' : (1.0, 0.388235294118, 0.278431372549),
    'tomato2' : (0.933333333333, 0.360784313725, 0.258823529412),
    'tomato3' : (0.803921568627, 0.309803921569, 0.223529411765),
    'tomato4' : (0.545098039216, 0.211764705882, 0.149019607843),
    'orangered1' : (1.0, 0.270588235294, 0.0),
    'orangered2' : (0.933333333333, 0.250980392157, 0.0),
    'orangered3' : (0.803921568627, 0.21568627451, 0.0),
    'orangered4' : (0.545098039216, 0.145098039216, 0.0),
    'red1' : (1.0, 0.0, 0.0),
    'red2' : (0.933333333333, 0.0, 0.0),
    'red3' : (0.803921568627, 0.0, 0.0),
    'red4' : (0.545098039216, 0.0, 0.0),
    'deeppink1' : (1.0, 0.078431372549, 0.576470588235),
    'deeppink2' : (0.933333333333, 0.0705882352941, 0.537254901961),
    'deeppink3' : (0.803921568627, 0.0627450980392, 0.462745098039),
    'deeppink4' : (0.545098039216, 0.0392156862745, 0.313725490196),
    'hotpink1' : (1.0, 0.43137254902, 0.705882352941),
    'hotpink2' : (0.933333333333, 0.41568627451, 0.654901960784),
    'hotpink3' : (0.803921568627, 0.376470588235, 0.564705882353),
    'hotpink4' : (0.545098039216, 0.227450980392, 0.38431372549),
    'pink1' : (1.0, 0.709803921569, 0.772549019608),
    'pink2' : (0.933333333333, 0.662745098039, 0.721568627451),
    'pink3' : (0.803921568627, 0.56862745098, 0.619607843137),
    'pink4' : (0.545098039216, 0.388235294118, 0.423529411765),
    'lightpink1' : (1.0, 0.682352941176, 0.725490196078),
    'lightpink2' : (0.933333333333, 0.635294117647, 0.678431372549),
    'lightpink3' : (0.803921568627, 0.549019607843, 0.58431372549),
    'lightpink4' : (0.545098039216, 0.372549019608, 0.396078431373),
    'palevioletred1' : (1.0, 0.509803921569, 0.670588235294),
    'palevioletred2' : (0.933333333333, 0.474509803922, 0.623529411765),
    'palevioletred3' : (0.803921568627, 0.407843137255, 0.537254901961),
    'palevioletred4' : (0.545098039216, 0.278431372549, 0.364705882353),
    'maroon1' : (1.0, 0.203921568627, 0.701960784314),
    'maroon2' : (0.933333333333, 0.188235294118, 0.654901960784),
    'maroon3' : (0.803921568627, 0.160784313725, 0.564705882353),
    'maroon4' : (0.545098039216, 0.109803921569, 0.38431372549),
    'violetred1' : (1.0, 0.243137254902, 0.588235294118),
    'violetred2' : (0.933333333333, 0.227450980392, 0.549019607843),
    'violetred3' : (0.803921568627, 0.196078431373, 0.470588235294),
    'violetred4' : (0.545098039216, 0.133333333333, 0.321568627451),
    'magenta1' : (1.0, 0.0, 1.0),
    'magenta2' : (0.933333333333, 0.0, 0.933333333333),
    'magenta3' : (0.803921568627, 0.0, 0.803921568627),
    'magenta4' : (0.545098039216, 0.0, 0.545098039216),
    'orchid1' : (1.0, 0.513725490196, 0.980392156863),
    'orchid2' : (0.933333333333, 0.478431372549, 0.913725490196),
    'orchid3' : (0.803921568627, 0.411764705882, 0.788235294118),
    'orchid4' : (0.545098039216, 0.278431372549, 0.537254901961),
    'plum1' : (1.0, 0.733333333333, 1.0),
    'plum2' : (0.933333333333, 0.682352941176, 0.933333333333),
    'plum3' : (0.803921568627, 0.588235294118, 0.803921568627),
    'plum4' : (0.545098039216, 0.4, 0.545098039216),
    'mediumorchid1' : (0.878431372549, 0.4, 1.0),
    'mediumorchid2' : (0.819607843137, 0.372549019608, 0.933333333333),
    'mediumorchid3' : (0.705882352941, 0.321568627451, 0.803921568627),
    'mediumorchid4' : (0.478431372549, 0.21568627451, 0.545098039216),
    'darkorchid1' : (0.749019607843, 0.243137254902, 1.0),
    'darkorchid2' : (0.698039215686, 0.227450980392, 0.933333333333),
    'darkorchid3' : (0.603921568627, 0.196078431373, 0.803921568627),
    'darkorchid4' : (0.407843137255, 0.133333333333, 0.545098039216),
    'purple1' : (0.607843137255, 0.188235294118, 1.0),
    'purple2' : (0.56862745098, 0.172549019608, 0.933333333333),
    'purple3' : (0.490196078431, 0.149019607843, 0.803921568627),
    'purple4' : (0.333333333333, 0.101960784314, 0.545098039216),
    'mediumpurple1' : (0.670588235294, 0.509803921569, 1.0),
    'mediumpurple2' : (0.623529411765, 0.474509803922, 0.933333333333),
    'mediumpurple3' : (0.537254901961, 0.407843137255, 0.803921568627),
    'mediumpurple4' : (0.364705882353, 0.278431372549, 0.545098039216),
    'thistle1' : (1.0, 0.882352941176, 1.0),
    'thistle2' : (0.933333333333, 0.823529411765, 0.933333333333),
    'thistle3' : (0.803921568627, 0.709803921569, 0.803921568627),
    'thistle4' : (0.545098039216, 0.482352941176, 0.545098039216),
    'grey0' : (0.0, 0.0, 0.0),
    'grey1' : (0.0117647058824, 0.0117647058824, 0.0117647058824),
    'grey2' : (0.0196078431373, 0.0196078431373, 0.0196078431373),
    'grey3' : (0.0313725490196, 0.0313725490196, 0.0313725490196),
    'grey4' : (0.0392156862745, 0.0392156862745, 0.0392156862745),
    'grey5' : (0.0509803921569, 0.0509803921569, 0.0509803921569),
    'grey6' : (0.0588235294118, 0.0588235294118, 0.0588235294118),
    'grey7' : (0.0705882352941, 0.0705882352941, 0.0705882352941),
    'grey8' : (0.078431372549, 0.078431372549, 0.078431372549),
    'grey9' : (0.0901960784314, 0.0901960784314, 0.0901960784314),
    'grey10' : (0.101960784314, 0.101960784314, 0.101960784314),
    'grey11' : (0.109803921569, 0.109803921569, 0.109803921569),
    'grey12' : (0.121568627451, 0.121568627451, 0.121568627451),
    'grey13' : (0.129411764706, 0.129411764706, 0.129411764706),
    'grey14' : (0.141176470588, 0.141176470588, 0.141176470588),
    'grey15' : (0.149019607843, 0.149019607843, 0.149019607843),
    'grey16' : (0.160784313725, 0.160784313725, 0.160784313725),
    'grey17' : (0.16862745098, 0.16862745098, 0.16862745098),
    'grey18' : (0.180392156863, 0.180392156863, 0.180392156863),
    'grey19' : (0.188235294118, 0.188235294118, 0.188235294118),
    'grey20' : (0.2, 0.2, 0.2),
    'grey21' : (0.211764705882, 0.211764705882, 0.211764705882),
    'grey22' : (0.219607843137, 0.219607843137, 0.219607843137),
    'grey23' : (0.23137254902, 0.23137254902, 0.23137254902),
    'grey24' : (0.239215686275, 0.239215686275, 0.239215686275),
    'grey25' : (0.250980392157, 0.250980392157, 0.250980392157),
    'grey26' : (0.258823529412, 0.258823529412, 0.258823529412),
    'grey27' : (0.270588235294, 0.270588235294, 0.270588235294),
    'grey28' : (0.278431372549, 0.278431372549, 0.278431372549),
    'grey29' : (0.290196078431, 0.290196078431, 0.290196078431),
    'grey30' : (0.301960784314, 0.301960784314, 0.301960784314),
    'grey31' : (0.309803921569, 0.309803921569, 0.309803921569),
    'grey32' : (0.321568627451, 0.321568627451, 0.321568627451),
    'grey33' : (0.329411764706, 0.329411764706, 0.329411764706),
    'grey34' : (0.341176470588, 0.341176470588, 0.341176470588),
    'grey35' : (0.349019607843, 0.349019607843, 0.349019607843),
    'grey36' : (0.360784313725, 0.360784313725, 0.360784313725),
    'grey37' : (0.36862745098, 0.36862745098, 0.36862745098),
    'grey38' : (0.380392156863, 0.380392156863, 0.380392156863),
    'grey39' : (0.388235294118, 0.388235294118, 0.388235294118),
    'grey40' : (0.4, 0.4, 0.4),
    'grey41' : (0.411764705882, 0.411764705882, 0.411764705882),
    'grey42' : (0.419607843137, 0.419607843137, 0.419607843137),
    'grey43' : (0.43137254902, 0.43137254902, 0.43137254902),
    'grey44' : (0.439215686275, 0.439215686275, 0.439215686275),
    'grey45' : (0.450980392157, 0.450980392157, 0.450980392157),
    'grey46' : (0.458823529412, 0.458823529412, 0.458823529412),
    'grey47' : (0.470588235294, 0.470588235294, 0.470588235294),
    'grey48' : (0.478431372549, 0.478431372549, 0.478431372549),
    'grey49' : (0.490196078431, 0.490196078431, 0.490196078431),
    'grey50' : (0.498039215686, 0.498039215686, 0.498039215686),
    'grey51' : (0.509803921569, 0.509803921569, 0.509803921569),
    'grey52' : (0.521568627451, 0.521568627451, 0.521568627451),
    'grey53' : (0.529411764706, 0.529411764706, 0.529411764706),
    'grey54' : (0.541176470588, 0.541176470588, 0.541176470588),
    'grey55' : (0.549019607843, 0.549019607843, 0.549019607843),
    'grey56' : (0.560784313725, 0.560784313725, 0.560784313725),
    'grey57' : (0.56862745098, 0.56862745098, 0.56862745098),
    'grey58' : (0.580392156863, 0.580392156863, 0.580392156863),
    'grey59' : (0.588235294118, 0.588235294118, 0.588235294118),
    'grey60' : (0.6, 0.6, 0.6),
    'grey61' : (0.611764705882, 0.611764705882, 0.611764705882),
    'grey62' : (0.619607843137, 0.619607843137, 0.619607843137),
    'grey63' : (0.63137254902, 0.63137254902, 0.63137254902),
    'grey64' : (0.639215686275, 0.639215686275, 0.639215686275),
    'grey65' : (0.650980392157, 0.650980392157, 0.650980392157),
    'grey66' : (0.658823529412, 0.658823529412, 0.658823529412),
    'grey67' : (0.670588235294, 0.670588235294, 0.670588235294),
    'grey68' : (0.678431372549, 0.678431372549, 0.678431372549),
    'grey69' : (0.690196078431, 0.690196078431, 0.690196078431),
    'grey70' : (0.701960784314, 0.701960784314, 0.701960784314),
    'grey71' : (0.709803921569, 0.709803921569, 0.709803921569),
    'grey72' : (0.721568627451, 0.721568627451, 0.721568627451),
    'grey73' : (0.729411764706, 0.729411764706, 0.729411764706),
    'grey74' : (0.741176470588, 0.741176470588, 0.741176470588),
    'grey75' : (0.749019607843, 0.749019607843, 0.749019607843),
    'grey76' : (0.760784313725, 0.760784313725, 0.760784313725),
    'grey77' : (0.76862745098, 0.76862745098, 0.76862745098),
    'grey78' : (0.780392156863, 0.780392156863, 0.780392156863),
    'grey79' : (0.788235294118, 0.788235294118, 0.788235294118),
    'grey80' : (0.8, 0.8, 0.8),
    'grey81' : (0.811764705882, 0.811764705882, 0.811764705882),
    'grey82' : (0.819607843137, 0.819607843137, 0.819607843137),
    'grey83' : (0.83137254902, 0.83137254902, 0.83137254902),
    'grey84' : (0.839215686275, 0.839215686275, 0.839215686275),
    'grey85' : (0.850980392157, 0.850980392157, 0.850980392157),
    'grey86' : (0.858823529412, 0.858823529412, 0.858823529412),
    'grey87' : (0.870588235294, 0.870588235294, 0.870588235294),
    'grey88' : (0.878431372549, 0.878431372549, 0.878431372549),
    'grey89' : (0.890196078431, 0.890196078431, 0.890196078431),
    'grey90' : (0.898039215686, 0.898039215686, 0.898039215686),
    'grey91' : (0.909803921569, 0.909803921569, 0.909803921569),
    'grey92' : (0.921568627451, 0.921568627451, 0.921568627451),
    'grey93' : (0.929411764706, 0.929411764706, 0.929411764706),
    'grey94' : (0.941176470588, 0.941176470588, 0.941176470588),
    'grey95' : (0.949019607843, 0.949019607843, 0.949019607843),
    'grey96' : (0.960784313725, 0.960784313725, 0.960784313725),
    'grey97' : (0.96862745098, 0.96862745098, 0.96862745098),
    'grey98' : (0.980392156863, 0.980392156863, 0.980392156863),
    'grey99' : (0.988235294118, 0.988235294118, 0.988235294118),
    'grey100' : (1.0, 1.0, 1.0),
    'darkgrey' : (0.662745098039, 0.662745098039, 0.662745098039),
    'darkblue' : (0.0, 0.0, 0.545098039216),
    'darkcyan' : (0.0, 0.545098039216, 0.545098039216),
    'darkmagenta' : (0.545098039216, 0.0, 0.545098039216),
    'darkred' : (0.545098039216, 0.0, 0.0),
    'lightgreen' : (0.564705882353, 0.933333333333, 0.564705882353),
}



if __name__ == "__main__":

    c1 = Color(.5, .2, .8)
    c2 = Color(1., 0., .2)
    print c1
    print repr(c1)
    print int(c1)
    print c1+c2
    print Color.white()
    print c1('rrrgggbbbaaa')
    print Color.from_palette('magenta').rgba8
    #palette.red += palette.blue
